using System;
using System.Xml.Schema;
using System.Xml.Serialization;
using flickr.api.communication;

namespace flickr.api
{
    [Serializable]
	public class User : FlickrObject
	{
        public User():base(){}
        public User(FlickrConnection connection) : base(connection){}
        
        [XmlAttribute("id", Form=XmlSchemaForm.Unqualified)]
        public string ID;

        [XmlAttribute("url", Form=XmlSchemaForm.Unqualified)]
        public string Url;

        [XmlElement("username")]
        public string Name;
        
        public Photos getPublicPhotos()
        {
            return getPublicPhotos(long.MinValue, long.MinValue);
        }

        public Photos getPublicPhotos(long photosPerPage, long selectedPage)
        {
            FlickrRequest request = new FlickrRequest("flickr.people.getPublicPhotos");
            request.AddParameter(FlickrParameterType.Nsid, ID);
                
            request.AddParameter(FlickrParameterType.PerPage, photosPerPage);
            request.AddParameter(FlickrParameterType.Page, selectedPage);

            return Send(request).Photos;
        }
	}
}
